package com.freewater.library.catalogue.infrastructure.springconfig;

import com.freewater.library.catalogue.infrastructure.dao.BookDao;
import com.freewater.library.catalogue.infrastructure.repository.BookRepositoryImpl;
import com.freewater.library.catalogue.model.BookFactory;
import com.freewater.library.catalogue.model.BookRepository;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

@Configuration
public class BookConfiguration {

    @Bean
    public BookRepository bookRepository(BookDao bookDao) {
        return new BookRepositoryImpl(bookDao);
    }

    @Bean
    public BookFactory bookFactory(BookRepository bookRepository) {
        return new BookFactory(bookRepository);
    }
}
